<?php

Route::group(['middleware' => ['web','auth:admin'], 'prefix' => 'goods', 'namespace' => 'Modules\Goods\Http\Controllers'], function()
{
    //注册一个商品操作的资源路由
    Route::resource('/goods', 'GoodsController');

//    Route::group(['middleware' => ['permission:manage attribute']], function () {
//        Route::resource('/attrs', 'AttrsController')->middleware("permission:admin,resource");
//    });






    //注册一个商品属性的资源路由
    Route::resource('/attrs', 'AttrsController')->middleware("permission:admin,resource");
    //注册一个商品分类的资源路由
    Route::resource('/fenlei','FenleiController')->middleware("permission:admin,resource");

    //注册一个获取所有子分类的路由
    Route::get('/getSonfenlei/{cid}','GoodsController@getSonfenlei')->name('getSonfenlei');
    //注册一个根据三级分类的cid获取可用属性的资源路由
    Route::get('/getAttrs/{cid}','GoodsController@getAttrs')->name('getAttrs');




    //注册一个货品的路由
    Route::get('/shop/{gid}','ShopController@index')->name('shop');
    //注册一个添加货品的路由
    Route::get('/shopcreate/{gid}','ShopController@create')->name('shopcreate');
    //注册一个处理添加货品的路由
    Route::post('/shopstore/{gid}','ShopController@store')->name('shopstore');
    //注册一个编辑货品的路由
    Route::get('/shopedit/{gid}/{id}','ShopController@edit')->name('shopedit');
    //注册一个处理编辑货品的路由
    Route::post('/shopupdate/{gid}/{id}','ShopController@update')->name('shopupdate');
    //注册一个删除某条货品的路由
    Route::post('/shopdel/{gid}','ShopController@destroy')->name('shopdel');
});
